package com.laopan.wxpay.request.refund;

import com.laopan.wxpay.WxConstants;
import com.laopan.wxpay.bean.refund.Refund;
import com.laopan.wxpay.bean.refund.RefundQueryParam;
import com.laopan.wxpay.bean.refund.RefundResult;
import com.laopan.wxpay.config.WxPayConfig;
import com.laopan.wxpay.exception.WxPayException;
import com.laopan.wxpay.request.RequestCallback;
import com.laopan.wxpay.request.WxPayRequest;
import com.laopan.wxpay.utils.JsonUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.util.EntityUtils;

/**
 * <p>
 *
 * </p>
 *
 * @author laopan
 * @className RefundQuery
 * @date 2021/4/15 13:32
 */
public class RefundQuery extends WxPayRequest<RefundQueryParam, RefundResult> {
    public RefundQuery(WxPayConfig wxPayConfig) {
        super(wxPayConfig);
    }

    @Override
    protected Class<RefundResult> getResultClass() {
        return RefundResult.class;
    }

    public RefundResult query(RefundQueryParam refund) throws WxPayException {
        return get(WxConstants.REFUND_PATH + "/" + refund.getRefundNo(), null);
    }

    public RefundResult query(RefundQueryParam refund, RequestCallback<RefundResult> requestCallback) throws WxPayException {
        return get(WxConstants.REFUND_PATH + "/" + refund.getRefundNo(), null, requestCallback);
    }
}
